
var drapDiv = document.getElementById("article"); 
drapDiv.addEventListener("dragstart",function (event) {
    //event.dataTransfer.setData("text","Hello");
    console.log("---");
    //event.dataTransfer.effectAllowed = "move";
    
});


//阻止div的拖放事件的默认行为 可以让其接受拖放
var dropDiv = document.getElementById("drop-container");
dropDiv.addEventListener("dragenter",onDrapEnter); 
function onDrapEnter(event) {
    event.preventDefault();    
    //event.dataTransfer.dropEffect = "move";
}

dropDiv.addEventListener("dragover",function (event) {
    event.preventDefault();
    //console.log(' dragover event.dataTransfer',event.dataTransfer);
    
});

dropDiv.addEventListener("drop",function (event) {
    
    var msg = event.dataTransfer.getData('text');//获取拖放的数据
    var url = event.dataTransfer.getData('url');//获取拖放的数据
    console.log("event=",msg,url);
    var img = document.getElementById("recieve");
    //img.src = url;
})